/* We’re using GetDateTime because the real Random() function only works when Quickdraw is active */
}
/**************/
/* */
/* EXAMPLE #1 */
/* */
/**************/
/* Now we’re actually going to display some init icons and names */
/* The Loch Ness Extension */
/* This example shows the most common way to show an init. */
ShowInitAndName ( 135, extensionNameInCFormat, nil, noErr, false ); /* Show the icon and init name and hilite the name (like it is selected) */
WaitFor ( 90 ); /* Pretend to do actual init work here */
ShowInitAndName ( 135, extensionNameInCFormat, nil, noErr, true ); /* Show the icon and init name again, but don’t hilite the name. and then move over for the next init */
WaitFor ( 15 ); /* Fake pause between inits */
/**************/
/* */
/* EXAMPLE #2 */
/* */
/**************/
/* CICNs */
/* In this example we’re actually using 'cicn's rather than 'icl8's. (The only way you
can tell is by looking at the resources with ResEdit; the routine call isn’t significant.)
We could have used 'cicn's in the previous two examples, as you don’t have to do anything different
to show 'cicn's. The routines automatically check
for either 'cicn's or 'icl8's with the specified resource id. */
/* Also, just to be different, we’re passing a pascal format string "\p"; */
/* which means we need to call ShowInitAndPascalName */
ShowInitAndPascalName ( 128, "\pICL8 or CICN", nil, noErr, false );
WaitFor ( 90 ); /* Pretend to do actual init work here */
ShowInitAndPascalName ( 128, "\pICL8 or CICN", nil, noErr, true );
WaitFor ( 15 ); /* Fake pause between inits */
/**************/
/* */
/* EXAMPLE #3 */
/* */
/**************/
/* No Bosses */
/* This example shows the most common way to show an init that fails. */
/* We’re going to load an error message here, so that it will be displayed to
the user. If you don't want to display an error message, simply pass nil
for the third parameter. */
GetIndString ( tempPascalString, kExampleErrorMessagesSTRResourceID, exampleErrorMessageStringIndex ); /* Get the message */
CopyCStringFromPascalStringWithLimit ( tempCString, tempPascalString, 255 ); /* Convert it to c-format */
AppendCStringToCStringWithLimit ( extensionNameInCFormat, "\015\015", 255 ); /* Add a couple of line feeds the extension name */
AppendCStringToCStringWithLimit ( extensionNameInCFormat, tempCString, 255 ); /* Add the message after the extension name and linefeeds */
/* Show the icon and init name and hilite the name (like it is selected) */
ShowInitAndName ( 133, "No Bosses", nil, noErr, false ); /* Show the icon and init name and hilite the name (like it is selected) */
WaitFor ( 90 ); /* Pretend to do actual init work here */
ShowInitAndName ( 134, "No Bosses", extensionNameInCFormat, nilHandleErr /* <-- whatever */, true ); /* ANY error number indicates the icon should be crossed out */
WaitFor ( 15 ); /* Fake pause between inits */
/**************/
/* */
/* EXAMPLE #4 */
/* */
/**************/
/* Animated Skier - “SKeys” */
/* You can animate an icon just by passing a different resource id to ShowInitAndName. */